Problem: Suppose that the angles of triangle $ABC$ satisfy
\[\cos 3A + \cos 3B + \cos 3C = 1.\]Two sides of the triangle have lengths 10 and 13.  Find the maximum length of the third side.
The condition $\cos 3A + \cos 3B + \cos 3C = 1$ implies
\begin{align*}
0 &= 1 - \cos 3A - (\cos 3B + \cos 3C) \\
&= 2 \sin^2 \frac{3A}{2} - 2 \cos \frac{3B + 3C}{2}  \cos \frac{3B - 3C}{2} \\
&= 2 \sin^2 \frac{3A}{2} - 2 \cos \left( 270^\circ - \frac{3A}{2} \right) \cos \frac{3B - 3C}{2} \\
&= 2 \sin^2 \frac{3A}{2} + 2 \sin \frac{3A}{2} \cos \frac{3B - 3C}{2} \\
&= 2 \sin \frac{3A}{2} \left( \sin \frac{3A}{2} + \cos \frac{3B - 3C}{2} \right) \\
&= 2 \sin \frac{3A}{2} \left( \sin \left( 270^\circ - \frac{3B + 3C}{2} \right) + \cos \frac{3B - 3C}{2} \right) \\
&= 2 \sin \frac{3A}{2} \left( \cos \frac{3B - 3C}{2} - \cos \frac{3B + 3C}{2} \right) \\
&= 2 \sin \frac{3A}{2} \cdot \left( -2 \sin \frac{3B}{2} \sin \left( -\frac{3C}{2} \right) \right) \\
&= 4 \sin \frac{3A}{2} \sin \frac{3B}{2} \sin \frac{3C}{2}.
\end{align*}Therefore, one of $\frac{3A}{2},$ $\frac{3B}{2},$ $\frac{3C}{2}$ must be $180^\circ,$ which means one of $A,$ $B,$ $C$ must be $120^\circ.$  Then the maximum length is obtained when the $120^\circ$ is between the sides of length 10 and 13.  By the Law of Cosines, this length is
\[\sqrt{10^2 + 10 \cdot 13 + 13^2} = \boxed{\sqrt{399}}.\]